package com.gmu.controller;


import com.gmu.domain.LoginAdminDetails;
import com.gmu.domain.ResResult;
import com.gmu.pojo.TblAdmin;
import com.gmu.service.TblMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 权限表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-07-24
 */
@Api(tags = "权限菜单")
@RestController
@RequestMapping("/gmu/tbl-menu")
public class TblMenuController {

    @Autowired
    private TblMenuService tblMenuService;

    @ApiOperation(value = "根据id获取用户菜单")
    @GetMapping("/getMenusByAdminId")
    public ResResult<?> getMenusByAdminId(){
        LoginAdminDetails loginAdminDetails = (LoginAdminDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return tblMenuService.getMenusByAdminId(loginAdminDetails.getTblAdmin().getId());
    }

}

